package com.fengkai.filepost.pdfoutstream.test.ODsolutions;

/**
 * @author Fengkai
 * @creat 2023/4/12
 * 输入描述:
 * 一个正整数 num
 * 0 < num <= 2147483647
 * 输出描述:
 * 如果成功找到，以单个空格分割，从小到大输出两个素数，分解失败，请输出-1 -1
 */
public class FindSuShu {
    public static void main (String[] args) {
        System.out.println(getTwoPrime(111));

    }


    public static String getTwoPrime(int number){
        for (int i = 2; i <= number >> 1; i++) {
            if (number % i == 0){
                if (ifPrime(i) && ifPrime(number / i)) {
                    return i < number/i ? i + " " + number/i : number/i + " " + i;
                }
            }
        }
        return "-1 -1";
    }
    private static boolean ifPrime (int num) {
        for (int i = 2; i <= num >> 1; i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
}
